package com.gexin.app.result;


import lombok.Data;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {


    public static final Integer CODE_SUCCESS = 700;
    public static final Integer CODE_ERROR = 701;
    public static final Integer CODE_NOT_FOUND = 702;


    public static final String SUCCESS_MESSAGE = "success";
    public static final String ERROR_MESSAGE = "An error occurred";
    public static final String NOT_FOUND_MESSAGE = "Resource not found";


    private T data;
    private Integer code;
    private String message;


    public Result(Integer code, String message) {
        this(null, code, message);
    }


    // 只包含数据的构造器
    public Result(T data) {
        this(data, CODE_SUCCESS, SUCCESS_MESSAGE);
    }



    public Result(T data, Integer code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

}
